<%--
  Created by IntelliJ IDEA.
  User: dj
  Date: 2018-08-30
  Time: 17:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<%@ include file="/common/baseMeta.jsp" %>
    <title>XSRRZ</title>
	<script type="text/javascript"> 
        var uid = "${sysStaffEntity.uid}";//唯一标识
        var lname = "${sysStaffEntity.lname}"; //登录工号
    $(function(){
		$("#l_datagrid").height(findDimensions_height() - 50);
        //初始化表头
        initGrid();
		//初始化日期控件
		var myDate = new Date();
		$('#nd').val(myDate.getFullYear());
		var month=myDate.getMonth()+1;
		$('#yf').val(month.toString().length==1?'0'+month:month);
		$.getJSON("/commapiV2", {p_dm: "sys_ks_GetzyXSR", userid: lname}, function (data) {
            if (data.success) {
				$('#ks').combobox({
                    data:data.Table,
                    valueField:'name',
                    textField:'name'
                });
				$('#ks').combobox('select',data.Table[0].name);
            }
            //getJSON方法与其他方法之间是同步加载方式，LoadGrid()方法放在外面取不到ks的值
            LoadGrid();
        }, true);
		
	})
	function LoadGrid()
	{
		//初始化数据
        $.getJSON("/commapiV2", {p_dm: "XSR_RZ_Get", rq: $('#nd').val()+'-'+$('#yf').val(),ks:$('#ks').combobox('getValue')}, function (data) {
            if (data.success) {
                var griddata = {};
                griddata.rows = data.Table;
                griddata.total = data.totalcount;
                $('#l_datagrid').datagrid('loadData', griddata);
            }
        }, true);
	}
	function initGrid() {
        $('#l_datagrid').datagrid({
            rownumbers: true,//显示行号
            singleSelect: true,//只显示一行
            fitColumns: true,
            sortable: true, //启用排序列
            collapsible: true,
            idField: 'id' ,
            columns: [
			            [
						    {field:'Sj',title:'日期',width:80,align:'center', rowspan:2},
                            {colspan:4,title:'<=1000g',width:250,align:'center'},
                            {colspan:4,title:'1001g~1500g',width:250,align:'center'},
                            {colspan:4,title:'1501g~2500g',width:250,align:'center'},
                            {colspan:4,title:'>2500g',width:250,align:'center'}, 
                            {field: 'usermc', title: '用户名', width: '80px', align: 'center', rowspan:2},
                            {field: 'cdate', title: '填写日期', width: '80px', align: 'center', rowspan:2}, 
                            {field: 'KsCode', title: 'KsCode', hidden: true, rowspan:2},
                        ],
                        [
				 
                            {field: 'NewCount1', title: '新住进<br />患者数', width: '60px', align: 'center'},
                            {field: 'TotalCount1', title: '住在<br />患者数', width: '60px', align: 'center'}, 
                            {field: 'ZxJmCount1', title: '中心静脉插管<br />患者数', width: '80px', align: 'center'},
                            {field: 'HxjCount1', title: '使用呼吸机<br />患者数', width: '80px', align: 'center'}, 
							
                            {field: 'NewCount2', title: '新住进<br />患者数', width: '60px', align: 'center'},
                            {field: 'TotalCount2', title: '住在<br />患者数', width: '60px', align: 'center'}, 
                            {field: 'ZxJmCount2', title: '中心静脉插管<br />患者数', width: '80px', align: 'center'},
                            {field: 'HxjCount2', title: '使用呼吸机<br />患者数', width: '80px', align: 'center'}, 
							
							
                            {field: 'NewCount3', title: '新住进<br />患者数', width: '60px', align: 'center'},
                            {field: 'TotalCount3', title: '住在<br />患者数', width: '60px', align: 'center'}, 
                            {field: 'ZxJmCount3', title: '中心静脉插管<br />患者数', width: '80px', align: 'center'},
                            {field: 'HxjCount3', title: '使用呼吸机<br />患者数', width: '80px', align: 'center'}, 
							
							
                            {field: 'NewCount4', title: '新住进<br />患者数', width: '60px', align: 'center'},
                            {field: 'TotalCount4', title: '住在<br />患者数', width: '60px', align: 'center'}, 
                            {field: 'ZxJmCount4', title: '中心静脉插管<br />患者数', width: '80px', align: 'center'},
                            {field: 'HxjCount4', title: '使用呼吸机<br />患者数', width: '80px', align: 'center'}, 
							
					
                        ]
                    ]
        });
    }
	function editItem()
	{   
        var row = $('#l_datagrid').datagrid('getSelected');
		var url = "/FormApi?mobanId=f38810d6-9342-446b-835f-b8d0349e3aaf&dataId=" + row.id +"&mDefaultValue_SJ="+row.Sj+"&mDefaultValue_KSCODE="+row.KsCode;
        layeropen(800, 500, "新生儿日志填写", url);
		
	}
	function loadList(){
		LoadGrid();
	}
	</script>
</head>
<body>
<div style="margin:0 5px; overflow: hidden;">
    <div class="navheader form-inline" style="height:40px;margin-bottom: 0px;">
        <div class=" form-group"> 
		    <label for="ZYNumber" style="padding:5px 10px 0 20px;">科室</label>
           <select id="ks" class="easyui-combobox"   style="height: 25px; width: 160px;">
                </select>
		   <label for="CYRQStart" style="padding:5px 10px 0 20px;">年度</label>
           <select id="nd"> 
		    <option value='2017'>2017</option>
		    <option value='2018'>2018</option>
		    <option value='2019'>2019</option>
		    <option value='2020'>2020</option>
		    <option value='2021'>2021</option>
		    <option value='2022'>2022</option> 
		    </select> 
		    <label for="CYRQStart" style="padding:5px 10px 0 20px;">月份</label>
           <select id="yf"> 
		    <option value='01'>01</option>
		    <option value='02'>02</option> 
		    <option value='03'>03</option> 
		    <option value='04'>04</option> 
		    <option value='05'>05</option> 
		    <option value='06'>06</option> 
		    <option value='07'>07</option> 
		    <option value='08'>08</option> 
		    <option value='09'>09</option>  
		    <option value='10'>10</option>  
		    <option value='11'>11</option>  
		    <option value='12'>12</option> 
		    </select> 
		    <button type="button" class="btn btn-success bi-btn-search" onclick="LoadGrid()">
               <span class="glyphicon glyphicon glyphicon-search"></span>
           </button>
		    <div class="btn-group-right">
                   <div class="btn-group" role="group">
                       <button type="button" class="btn btn-default bi-btn-width90" onclick="editItem()">编辑</button>
                   </div>
               </div>
		</div>
    </div>
    <div style="width:100%;float:left;display:inline-block;padding-top:10px;">
        <table id="l_datagrid" class="datagrid" style="width:100%">
		 
		</table>
    </div>
</div>
</body>
</html>
